package com.sn.author.service.impl;

import com.github.pagehelper.PageInfo;
import com.sn.author.dao.ImportAccountMapper;
import com.sn.author.dao.ImportVideoMapper;
import com.sn.author.domain.BaseResult;
import com.sn.author.domain.dto.VideoDTO;
import com.sn.author.domain.entity.ImportVideo;
import com.sn.author.domain.vo.PageVo;
import com.sn.author.service.dao.AttentionService;
import com.sn.author.service.dao.TaskService;
import com.sn.author.utils.BeanUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author xiaom
 * @Date 2020/9/18 14:22
 * @Version 1.0.0
 * @Description <>
 **/
@Service
@Slf4j
public class AttentionServiceImpl implements AttentionService {

    @Resource
    private ImportVideoMapper importVideoMapper;

    @Resource
    private ImportAccountMapper importAccountMapper;

    @Autowired
    private TaskService taskService;


    @Override
    public BaseResult<List<VideoDTO>> list(PageVo pageVo) {
        startPage(pageVo);
        List<ImportVideo> list = importVideoMapper.selectBySort("import_time","desc");
        PageInfo<ImportVideo> pageInfo = new PageInfo<>(list);
        return BaseResult.success(BeanUtils.coventObject(pageInfo.getList(),VideoDTO.class),pageInfo.getTotal());
    }
}
